package com.xiaoshuidi.cloud.module.member.controller.admin.point.vo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.util.StringUtils;
import com.xiaoshuidi.cloud.module.member.enums.point.PointChangeEnums;
import com.xiaoshuidi.cloud.module.member.enums.point.PointChangeValueEnums;
import com.xiaoshuidi.cloud.module.member.enums.point.PointRecordEnums;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Date;

@Data
public class MemberPointChangesExportVo {

    @ExcelProperty("积分流水号")
    private String recordNo;

    @ExcelProperty("积分变动时间")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @Schema(description = "积分变动时间")
    private Date updateTime;

    @ExcelProperty("手机号")
    private String phone;

    @ExcelProperty("记录类型")
    private String recordTypeStr;

    @ExcelProperty("发放类型")
    private String changeTypeStr;

    @ExcelProperty("增减项")
    private String changeValueTypeStr;

    @ExcelIgnore
    private Integer recordType;

    @ExcelIgnore
    private Integer changeType;

    @ExcelIgnore
    private Integer changeValueType;

    @ExcelProperty("增减值")
    private Long changeValue;

    @ExcelProperty("变动前积分")
    private Long beforeChangePoints;

    @ExcelProperty("变动后积分")
    private Long afterChangePoints;

    @ExcelProperty("备注")
    private String remark;



    public String getRecordTypeStr() {
        if (PointRecordEnums.getPointRecordEnumsByValue(recordType) != null) {
            return PointRecordEnums.getPointRecordEnumsByValue(recordType).msg;
        } else {
            return StringUtils.EMPTY;
        }
    }

    public String getChangeTypeStr() {
        if (PointChangeEnums.getMsgByKey(changeType) != null) {
            return PointChangeEnums.getMsgByKey(changeType);
        } else {
            return StringUtils.EMPTY;
        }
    }

    public String getChangeValueTypeStr() {
        if (PointChangeValueEnums.getMsgByKey(changeValueType) != null) {
            return PointChangeValueEnums.getMsgByKey(changeValueType);
        } else {
            return StringUtils.EMPTY;
        }
    }
}
